<template>
	<div>
		<input type="file" @change="changeFile"/>
	</div>
</template>

<script>
import XLSX from 'xlsx';
import urlJSON from './menus';

export default {
	name:'Test',
	methods:{
		changeFile({target:{files:[file]}}){
			const reader=new FileReader();
			reader.onload=() => {
				const data=new Uint8Array(reader.result);
				const workbook=XLSX.read(data,{type:'array'});
				const json=XLSX.utils.sheet_to_json(workbook.Sheets[workbook.SheetNames[0]]);
				for(let i=0;i<json.length;++i){
					const row=json[i];
					const code=row['页面CODE'];
					if(code){
						const cur=urlJSON[code];
						if(!cur){
							console.log('不存在',code,row['菜单名称'],row['链接地址']);
						}else if(row['菜单名称']!==cur.title){
							console.log('菜单名称不对',code,row['菜单名称'],row['链接地址']);
						}else if(row['链接地址']!==cur.url){
							console.log('链接地址不对',code,row['菜单名称'],row['链接地址']);
						}
					}
				}
				console.log('完成===================');
			};
			reader.readAsArrayBuffer(file);
		}
	}
};
</script>

<style lang="scss">

</style>
